$(document).ready(function(){
	//Botones Show/Hide Caja de login
	$("#box-close").click(function(){
		$("#box-login").animate({
			opacity: "hide"
		 }, 300);
	});
	$('#btn-login').click(function(){
		var action = ($("#box-login").css("display") == 'none')? "show": "hide";
		
		$("#box-login").animate({
			opacity: action
		 }, 300, function(){
			 if(action == "show")
				 $("#int-email").focus();
		 });
	});
	
	//Login de usuario Formulario
	$("#frm-login").submit(function(){
		$("#res_login").html('<img src="'+base_url+'application/images/loading.gif" width="10" height="10">');
		$.getJSON(base_url+"services/user/login",
		{
			email: this.email.value,
			password: this.password.value
		},
		function(data){
			if(data.status.code == 200){
				window.location = base_url+lang_url;
			}
			$("#res_login").text(data.status.message);
		});
		return false;
	});
	
	
	//evento a login facebook
	$('.acces-facebook').click(function(){
		$(this).css('display', 'none');
		$('.loader-face').css('display', 'block');
	});
	
});
